﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MethodWorx.CMS.Plugins.AssetManagement;
using MethodWorx.CMS.TemplateLanguage;
using MethodWorx.CMS.Providers;
using System.Web;

namespace MethodWorx.CMS.Plugins.CssManagement
{
    public class CssManagementExtension : IRequestPlugin
    {
        private IdeExtension pageTemplateIdeExtensions = new IdeExtension()
        {
            Id = new Guid("{A2106721-AF43-40F6-B7FB-7451E082151C}"),
            DisplayName = "Stylesheets",
            Name = "Page Template Stylesheet Management",
            WebEditor = new AssemblyResourceReference(typeof(CssManagementExtension).Assembly, "Plugins/Views/CssManagement/PageTemplateCssManagement.ascx"),
            Controller = typeof(PageTemplateCssManagement)
        };

        public bool ProcessRequest(HttpContextBase context)
        {
            return false;
        }

        public Guid Id
        {
            get { return Guid.Parse("{9A26EE83-F24D-458A-9D14-A2CCFC4DB27E}"); }
        }

        public IEnumerable<IdeExtension> GetIdeExtensionsForPageTemplate(Content.PageTemplate template)
        {
            yield return pageTemplateIdeExtensions;
        }

        public IEnumerable<IdeExtension> GetIdeExtensionsForPage(Content.Page page)
        {
            return new IdeExtension[] { };
        }

        public IEnumerable<IdeExtension> GetIdeExtensions()
        {
            yield return pageTemplateIdeExtensions;
        }

        public IEnumerable<IParser> GetTmlExtensions()
        {
            return new IParser [] { }; 
        }

        public string Name
        {
            get { return "CSS Management"; }
        }

        public string Description
        {
            get { return "Allow management of CSS and stylesheets"; }
        }

        #region IRequestPlugin Members


        public IEnumerable<VirtualUrl> GetVirtualUrls(string filter, string contextType, string contextId)
        {
            throw new NotImplementedException();
        }

        #endregion

        private ICmsDataProvider provider;
        public void SetProvider(ICmsDataProvider provider)
        {
            this.provider = provider;
        }
    }
}
